import  {xsEntity} from '../commentity';
import { Column ,Entity, ManyToOne} from 'typeorm';
import { UserEntity } from '../userinfo/user';
import { AddressEntity } from '../userinfo/payAddress';
import { NovelEntity } from '../novel/novel';

/**
 * 描述
 */
@Entity()
export class OrderEntity extends xsEntity {

    @Column({ comment: '订单编号' })
    orderSn: string;
    @Column({ comment: '订单状态  0.付款, 1, 已付款',default:0 })
    orderStatus: number;
    

    
    @Column({ comment: '备注' ,default:"" })
    message: string;
    
    // @OneToMany(()=>Zlwh_orderItemEntity,orderItemlist => orderItemlist.item)
    // orderItemlist: Zlwh_orderItemEntity[]
  
    @ManyToOne(() =>UserEntity , UserEntity => UserEntity.id)
    userId :UserEntity
    
    @ManyToOne(() =>AddressEntity , AddressEntity => AddressEntity.id)
    payaddress:AddressEntity
    
    
    @ManyToOne(() =>NovelEntity , NovelEntity => NovelEntity.id)
    novel:NovelEntity
    



    @Column({ comment: '运费' ,default:0})
    freightPrice: number;
  
    @Column({ comment: '积分',default:0 })
    integralPrice: number ;
  
    @Column({ comment: '团购',default:0 })
    grouponPrice: number ;
  
    
    @Column({ comment: '订单价格',type:"double",scale:2 })
    orderPrice: number ;
    
    @Column({ comment: '实付款价格' ,type:"double",scale:2})
    actualPrice: number ;
  
    @Column({ comment: '优惠价抵扣金额',type:"double" ,scale:2,default:0 })
    coupon_amount: number ;
    @Column({ comment: '管理员调整订单折扣',default:0 })
    discount_amount: number ;
  
    @Column({ comment: '退款价格' ,default:0, type:"double",scale:2})
    refund: number ;
    

    @Column({ comment: '支付方式：0->未支付；1->信用卡；2->paypel',default:0 })
    pay_type: number ;
    @Column({ comment: '订单来源: 0小程序, 1是H5',default:null })
    source_type: string ;
    @Column({ comment: '订单状态：0->待付款；1->待发货；2->已发货；3->已完成；4->已关闭；5->无效订单',default:null })
    status: number ;
    @Column({ comment: '发货时间',default:null ,type: "datetime"})
    delivery_time: Date ;
  
    
    @Column({ comment: '支付时间' ,default:null})
    payTime: Date;
    
    @Column({ comment: '删除' ,default:false })
    deleted: boolean;
    
    @Column({ comment: '推广佣金' ,default:0 })
    discount: number;
    

    
    @Column({ comment: '结算款',default:null })
    settlementMoney: number;
  
    @Column({ comment: '给商家结算' ,default:false})
    settlementStatus: boolean;
  
  
  
    @Column({ comment: '分享id' ,default:0})
    shareUserId: number;
  
    @Column({ comment: '佣金' ,default:0})
    brokeragePrice: number;
  
    @Column({ comment: '是否退款' ,default:false})
    hasRefund: boolean;
  
  
    @Column({ comment: '快递公司'  ,default:""})
    shipChannel: string;
  
    @Column({ comment: '运单号',default:"" })
    shipSn: string;
  
}
